﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 设计模式.拦截过滤器模式
{
   public class FilterChain
    {
        private List<IFilter> filters = new List<IFilter>();

        public Target Target { set; get; }
        public void AddFilter(IFilter filter)
        {
            filters.Add(filter);
        }

        public void Execute(string request)
        {
            foreach(IFilter filter in filters)
            {
                filter.Execute(request);
            }
            Target.Execute(request);
        }
    }
}
